package com.zh.test.redis;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zh.test.bean.Activity;
import org.bridj.ann.Array;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/test/redis/")
public class RedisController {

    @Autowired
    public RedisUtils redisUtils;

    //jackson核心组件objectMapper
    @Autowired
    public ObjectMapper Json;

    @RequestMapping("/op")
    public String op(){
        redisUtils.op1();
       return redisUtils.op2();
    }
    @RequestMapping("/op2")
    public void op2() throws JsonProcessingException {
        Activity activity = new Activity();
        activity.setAge(11).setTime(new Date()).setName("zhangsan");

        String string = Json.writeValueAsString(activity);
    }
}
